define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'ordertbk/index',
                    add_url: 'ordertbk/add',
                    edit_url: 'ordertbk/edit',
                    del_url: 'ordertbk/del',
                    multi_url: 'ordertbk/multi',
                    table: 'order_tbk',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                search: false,
                searchFormVisible: true,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'auctionId', title: __('Auctionid')},
                        {field: 'auctionNum', title: __('Auctionnum')},
                        {field: 'auctionTitle', title: __('Auctiontitle')},
                        {field: 'auctionUrl', title: __('Auctionurl'), formatter: Table.api.formatter.url},
                        // {field: 'bizType', title: __('Biztype')},
                        {field: 'createTime', title: __('Createtime')},
                        {field: 'discountAndSubsidyToString', title: __('Discountandsubsidytostring')},
                        {field: 'earningTime', title: __('Earningtime')},
                        // {field: 'exMemberId', title: __('Exmemberid')},
                        // {field: 'exNickName', title: __('Exnickname')},
                        // {field: 'exShopTitle', title: __('Exshoptitle')},
                        {field: 'feeString', title: __('Feestring'), operate:'BETWEEN'},
                        {field: 'finalDiscountToString', title: __('Finaldiscounttostring'), operate:'BETWEEN'},
                        // {field: 'inviterAccountName', title: __('Inviteraccountname')},
                        // {field: 'inviterId', title: __('Inviterid')},
                        {field: 'payPrice', title: __('Payprice'), operate:'BETWEEN'},
                        {field: 'payStatus', title: __('Paystatus'), visible: false, searchList: Config.payStatusList},
                        {field: 'pay_status_text', title: __('Paystatus'), operate: false},
                        // {field: 'preFinishServiceFee', title: __('Prefinishservicefee')},
                        // {field: 'preServiceFee', title: __('Preservicefee')},
                        {field: 'realPayFee', title: __('Realpayfee'), operate:'BETWEEN'},
                        {field: 'realPayFeeString', title: __('Realpayfeestring')},
                        // {field: 'relationApp', title: __('Relationapp')},
                        // {field: 'relationId', title: __('Relationid')},
                        // {field: 'shareRate', title: __('Sharerate')},
                        {field: 'taobaoTradeParentId', title: __('Taobaotradeparentid')},
                        // {field: 'terminalType', title: __('Terminaltype')},
                        // {field: 'tk3rdPubShareFee', title: __('Tk3rdpubsharefee')},
                        // {field: 'tk3rdTypeStr', title: __('Tk3rdtypestr')},
                        // {field: 'tkAlimmShareRate', title: __('Tkalimmsharerate')},
                        // {field: 'tkBizTag', title: __('Tkbiztag')},
                        // {field: 'tkPubShareFeeString', title: __('Tkpubsharefeestring')},
                        // {field: 'tkServiceRate', title: __('Tkservicerate')},
                        // {field: 'tkShareRate', title: __('Tksharerate')},
                        // {field: 'tkShareRateToString', title: __('Tkshareratetostring')},
                        // {field: 'totalAlipayFeeString', title: __('Totalalipayfeestring')},
                        {field: 'merid', title: __('Merid')},
                        {field: 'user_id', title: __('User_id')},
                        {field: 'record_id', title: __('Record_id')},
                        {field: 'status', title: __('Status'), visible: false, searchList: Config.statusList},
                        {field: 'status_text', title: __('Status'), operate: false},
                        // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});